fn main() {
    // round 1
    let width1 = 30;
    let height1 = 50;

    println!(
        "The area of the rectangle is {} square pixels.",
        area_1(width1, height1)
    );

    //round 2
    let rect1 = Rectangle {
        width: 30,
        height: 50,
    };
    println!(" rect1 is {:?}", rect1);
    println!(" rect1 is {:#?}", rect1);
    println!(
        "The area of the rectangle is {} square pixels.",
        area_2(&rect1)
    );

    //round 3
    let scale = 2;
    let rect1 = Rectangle {
        width: dbg!(30 * scale),
        height: 50,
    };

    dbg!(&rect1);

    //round 4
    println!(
        "The area of the rantangle is {} square pixels.",
        rect1.area()
    );
}

fn area_1(width: u32, height: u32) -> u32 {
    return width * height;
}

#[derive(Debug)]
struct Rectangle {
    width: u32,
    height: u32,
}

impl Rectangle {
    fn area(&self) -> u32 {
        self.width * self.height
    }
}

fn area_2(rectangle: &Rectangle) -> u32 {
    rectangle.width * rectangle.height
}
